package com.reeygu.cli.example;

import picocli.CommandLine;

import java.util.concurrent.Callable;

public class LoginExample implements Callable<Integer> {
    @CommandLine.Option(names = {"-u", "--user"}, description = "User name")
    String user;

    @CommandLine.Option(names = {"-p", "--password"},
            description = "Passphrase",
            interactive = true,
            arity = "0..1",
            prompt = "请输入密码:")
    String password;

    @CommandLine.Option(names = {"-ps", "--passwords"},
            description = "Passphrase",
            interactive = true,
            arity = "0..1",
            prompt = "请确认密码:")
    String passwordTow;

    public Integer call() throws Exception {
        System.out.println("password = " + password);
        return 0;
    }

    public static void main(String[] args) {
        new CommandLine(new LoginExample()).execute("-u", "user123", "-p");
    }
}
